package com.ruoyi.listen.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.listen.mapper.ListenApplyMapper;
import com.ruoyi.listen.domain.ListenApply;
import com.ruoyi.listen.service.IListenApplyService;

/**
 * 听课申请Service业务层处理
 * 
 * @author yepanpan
 * @date 2021-03-15
 */
@Service
public class ListenApplyServiceImpl implements IListenApplyService 
{
    @Autowired
    private ListenApplyMapper listenApplyMapper;

    /**
     * 查询听课申请
     * 
     * @param id 听课申请ID
     * @return 听课申请
     */
    @Override
    public ListenApply selectListenApplyById(Long id)
    {
        return listenApplyMapper.selectListenApplyById(id);
    }

    /**
     * 查询听课申请列表
     * 
     * @param listenApply 听课申请
     * @return 听课申请
     */
    @Override
    public List<ListenApply> selectListenApplyList(ListenApply listenApply)
    {
        return listenApplyMapper.selectListenApplyList(listenApply);
    }

    /**
     * 新增听课申请
     * 
     * @param listenApply 听课申请
     * @return 结果
     */
    @Override
    public int insertListenApply(ListenApply listenApply)
    {
        listenApply.setCreateTime(DateUtils.getNowDate());
        listenApply.setCreateBy(SecurityUtils.getUsername());
        return listenApplyMapper.insertListenApply(listenApply);
    }

    /**
     * 修改听课申请
     * 
     * @param listenApply 听课申请
     * @return 结果
     */
    @Override
    public int updateListenApply(ListenApply listenApply)
    {
        listenApply.setUpdateTime(DateUtils.getNowDate());
        listenApply.setUpdateBy(SecurityUtils.getUsername());
        return listenApplyMapper.updateListenApply(listenApply);
    }

    /**
     * 批量删除听课申请
     * 
     * @param ids 需要删除的听课申请ID
     * @return 结果
     */
    @Override
    public int deleteListenApplyByIds(Long[] ids)
    {
        return listenApplyMapper.deleteListenApplyByIds(ids);
    }

    /**
     * 删除听课申请信息
     * 
     * @param id 听课申请ID
     * @return 结果
     */
    @Override
    public int deleteListenApplyById(Long id)
    {
        return listenApplyMapper.deleteListenApplyById(id);
    }
    

    /**
     * 批量审核听课申请
     * 
     * @param ids 需要审核的听课申请ID
     * @return 结果
     */
    @Override
    public int checkListenApplyByIds(Long[] ids) {
        return listenApplyMapper.checkListenApplyByIds(ids);
    }
}
